using System;
using System.ComponentModel;
using System.ComponentModel.Design;
using System.Collections;
using System.Drawing;
using System.Workflow.ComponentModel;
using System.Workflow.ComponentModel.Design;
using System.Workflow.ComponentModel.Compiler;
using System.Workflow.ComponentModel.Serialization;
using System.Workflow.Runtime;
using System.Workflow.Activities;
using System.Workflow.Activities.Rules;

namespace Decav.Gatsb.Application.CommandWorkflow
{
    /// <summary>
    /// Gets the current location of the authenticated user.
    /// </summary>
	public partial class GetUserCurrentLocationActivity: Activity
	{
		public GetUserCurrentLocationActivity()
		{
			InitializeComponent();
		}

        /// <summary>
        /// The dependency property that gets or sets the users current location.
        /// </summary>
        public static DependencyProperty CurrentLocationProperty = DependencyProperty.Register(
            "CurrentLocation", typeof(LocationCheckin), typeof(GetUserCurrentLocationActivity));

        /// <summary>
        /// Gets or sets the users current location.
        /// </summary>
        public LocationCheckin CurrentLocation
        {
            get { return (LocationCheckin)GetValue(CurrentLocationProperty); }
            set { SetValue(CurrentLocationProperty, value); }
        }
        

        protected override ActivityExecutionStatus Execute(ActivityExecutionContext executionContext)
        {
            CurrentLocation = GatsbApplication.Current.GetUserLocation(GatsbApplication.Current.CurrentUser);
            return ActivityExecutionStatus.Closed;
        }
	}
}
